//
//  AUSharedModule_Test.swift
//  AwesomeUSharedModule_Example
//
//  Created by Miss_Special on 2018/4/12.
//  Copyright © 2018 CocoaPods. All rights reserved.
//

import UIKit

import AwesomeUSharedModule

extension AUSharedModule {
    // 测试_1
    public func test_TestVC_testAction(params: String) {
        // 得到应用名称
        guard let nameSpace = Bundle.main.object(forInfoDictionaryKey: "CFBundleExecutable") as? String else {
            return
        }
        
        if let tempClass = NSClassFromString("\(nameSpace).TestVC") as? UIViewController.Type {
            print("测试部分开始---2")
            let tempTarget = tempClass.init()
            // 没有参数
            // let tempSel1 = Selector(("test1"))
            // 一个参数
            let tempSel2 = Selector(("test2:"))
            // 两个参数
            // let tempSel3 = Selector(("test3:param2:"))
            tempTarget.perform(tempSel2, with: params)
        }
    }
    
    /**
     scheme://[target]/[action]?[params]
     
     example:
     xxx://targetA/actionA?id=1&name="hhh"
     */
    public func test_url() {
//        let urlString = "home://TestVC/test1?id=1&name=xxx"
//        if let url = URL(string: urlString) {
//            au_performActionWithUrl(url: url) {
//                print("------------")
//            }
//        }
    }
    
    public func test(_ idString: String, name: String) {
        
//        let urlString = "example://module/TestVC_Wrapper/test_wrapper:?id=\(idString)&name=\(name)"
//        if let url = URL(string: urlString) {
//            au_performActionWithUrl(url: url) {
//                print("+++++++")
//            }
//        }
    }
}
